import Vue from 'vue'
import App from './App.vue'
import router from './router'
import 'element-ui/lib/theme-chalk/index.css'
import 'amfe-flexible'
import axios from 'axios'
import * as filter from './filter/index'
import directive from './directive/index'
import TiShi from './alert/index'
Vue.use(TiShi)
directive(Vue)
Object.keys(filter).forEach(key => {
    Vue.filter(key, filter[key])
})
Vue.prototype.$http = axios
axios.interceptors.request.use(function (config) {
    if (localStorage.getItem('token')) {
        config.headers.Authorization = JSON.parse(localStorage.getItem('token')).token
    }
    return config;
}, function (error) {
    return Promise.reject(error);
});
axios.interceptors.response.use(function (res) {
    return res;
}, function (error) {
    return Promise.reject(error);
});
Vue.config.productionTip = false
new Vue({
    router,
    render: h => h(App)
}).$mount('#app')
